import 'package:flutter/material.dart';
import 'package:flutter_pro/routes/info_page.dart';
import 'package:get/get.dart';

class NewsPage extends StatefulWidget {
  const NewsPage({super.key});

  @override
  State<NewsPage> createState() => _NewsPageState();
}

class _NewsPageState extends State<NewsPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("资讯"),
      ),
      body: ListView.builder(
        itemCount: 10,
        itemBuilder: (BuildContext context, int index) {
          return InkWell(
            onTap: () {
              Get.to(const InfoPage());
            },
            child: Container(
              width: Get.width,
              margin: const EdgeInsets.only(left: 16),
              padding: const EdgeInsets.fromLTRB(0, 12, 12, 12),
              decoration: const BoxDecoration(
                border: Border(
                  bottom: BorderSide(color: Color(0xffe5e5e5), width: 1),
                ),
              ),
              child: Row(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Expanded(
                    flex: 1,
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Text(
                          "标题$index",
                          style: const TextStyle(
                              fontSize: 18,
                              fontWeight: FontWeight.bold,
                              color: Color(0xff333333)),
                        ),
                        Text(
                          "内容$index 是指自协调世界时(UTC)的1970年1月1日00:00:00起至现在所经过的秒数。它被广泛用于计算机系统中记录和表示时间。 时间 当前时间戳(秒) 当前时间戳(毫...",
                          maxLines: 3,
                          overflow: TextOverflow.clip,
                          style: const TextStyle(
                            fontSize: 14,
                            color: Color(0xff666666),
                            height: 2,
                          ),
                        )
                      ],
                    ),
                  ),
                  ClipRRect(
                    borderRadius: const BorderRadius.all(Radius.circular(8)),
                    child: Image.network(
                        width: 90,
                        height: 70,
                        "https://cdn-img.panewslab.com/panews/2024/04/23/images/Qb6oY958g8.jpg"),
                  ),
                ],
              ),
            ),
          );
        },
      ),
    );
  }
}
